<template>
  <div class="spec-preview">
    <vuePhotoZoomPro :high-url="url||imgUrl" :out-zoomer="true" :width="200" :height="200">
      <img :src="url||imgUrl" width="400" height="400" />
    </vuePhotoZoomPro>
  </div>
</template>

<script >
import { defineComponent } from "vue";
export default defineComponent({
  name: "Zoom",
});
</script>

<script setup>
import { toRefs, ref } from 'vue'
import vuePhotoZoomPro from "vue-photo-zoom-pro";
import "vue-photo-zoom-pro/dist/style/vue-photo-zoom-pro.css";
import emitter from '@/utils/bus.js'
const props = defineProps(['imgUrl'])
const { imgUrl } = toRefs(props)
const url = ref('')

emitter.on('getUrl', (data) => {
  url.value = data
 
})


</script>

<style lang="less">
.spec-preview {
  position: relative;
  width: 400px;
  height: 400px;
  border: 1px solid #ccc;

  .zoomer {
    // 放大区域的样式
    z-index: 5;
    top: 0 !important;
    left: 10px !important;
  }

  .selector {
    // mask的样式
    background-color: rgba(255, 0, 0, 0.327);
  }
}
</style>